package com.jsyl.infra.utils;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * Constant values used throughout the application.
 * 
 * @ClassName: Constants
 * @author: QuBinBin
 * @date: 2014-2-8 下午9:31:19
 * 
 */
@Component
public class Constants {

	/** 分隔符 逗号',' */
	public static final String DELIMITER = ",";

	/** 分隔符 冒号':' */
	public static final String COLON = ":";

	/** 分隔符 分号';' */
	public static final String SEMICOLON = ";";

	/**
	 * 获取当前用户信息名SESSION 使用方法：UserVO userVO =
	 * (UserVO)request.getSession.getAttribute(ConstantUtil.CURRENT_USER); key
	 * in Session indicating current user
	 */
	public static final String CURRENT_USER = "current_user";

	public static final String FRONT_USER_ID = "front_user_id";

	/** 公共错误页面的错误信息接收参数 */
	public static final String COMMON_ERROR_MSG = "errorMsg";

	/** 发送邮件的服务器的IP */
	public static String MAIL_SERVERHOST;

	@Value("#{configProperties['mail.serverHost']}")
	private void setServerHost(String serverHost) {
		MAIL_SERVERHOST = serverHost;
	}

	/** 发送邮件的服务器的端口 */
	public static String MAIL_SERVERPORT;

	@Value("#{configProperties['mail.serverPort']}")
	private void setServerPort(String serverPort) {
		MAIL_SERVERPORT = serverPort;
	}

	/** 邮件发送者的地址 */
	public static String MAIL_FROMADDRESS;

	@Value("#{configProperties['mail.fromAddress']}")
	private void setFromAddress(String fromAddress) {
		MAIL_FROMADDRESS = fromAddress;
	}

	/** 登陆邮件发送服务器的用户名 */
	public static String MAIL_USERNAME;

	@Value("#{configProperties['mail.userName']}")
	private void setMailUserName(String userName) {
		MAIL_USERNAME = userName;
	}

	/** 登陆邮件发送服务器的密码 */
	public static String MAIL_PASSWORD;

	@Value("#{configProperties['mail.password']}")
	private void setMailPassword(String password) {
		MAIL_PASSWORD = password;
	}

	/** 是否需要身份验证 */
	public static boolean MAIL_VALIDATE;

	@Value("#{configProperties['mail.validate']}")
	private void setMailValidate(boolean validate) {
		MAIL_VALIDATE = validate;
	}

	/** 预警定时任务触发时间 */
	public static final String QUARTZ_CRONEXPRESSION = "0 0 6 * * ?";

}
